package com.dsjy.yf.address.security.common.api;

import com.dsjy.yf.address.config.base.CommonEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author RYZEYANG
 * @date 2020/10/24 14:50
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CommonResult<T> {
    /**
     * 描述
     */
    private String msg;
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 数据
     */
    private T data;

    public CommonResult(CommonEnum resultEnum, T data) {
        this.msg = resultEnum.getResultMsg();
        this.code = resultEnum.getResultCode();
        this.data = data;
    }

    public CommonResult(Integer code, String msg) {
        this.msg = msg;
        this.code = code;
        this.data = null;
    }

}
